How to Remove Items in a Set in Python Using the discard() Method

28

nameSet = {"John", "Jane", "Doe"}

nameSet.discard("John")

print(nameSet)
# {'Doe', 'Jane'}

Comments

Submit
0 Comments